package com.fs.entity;

import lombok.Data;

/**
 * 〈一句话功能简述〉<br>
 *
 * @author Carol
 * @create 2024/5/10
 * @since 1.0.0
 */
@Data
public class ResponseData {
    private  Integer status;  //状态码
    private String msg; //操作消息
    private  Object data;

    public ResponseData() {
    }

    public ResponseData(Integer status, String msg, Object data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public ResponseData(Integer status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public ResponseData(Integer status, Object data) {
        this.status = status;
        this.data = data;
    }

    public ResponseData(Integer status) {
        this.status = status;
    }

    //成功响应  带消息
    public static ResponseData ok(int status, String msg){
        return new ResponseData(status,msg);
    }
    //成功响应 带数据
    public static ResponseData ok(Object data){
        return new ResponseData(200,data);
    }

    public static ResponseData ok(){
        return new ResponseData(200);
    }

    //失败响应
    public static ResponseData error(int status,String msg){
        return new ResponseData(status,msg);
    }

    public static ResponseData error(String msg){
        return new ResponseData(500,msg);
    }

}